package web;

import entity.Province;
import service.ProvinceService;
import service.impl.ProvinceServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/province")
public class ProvinceServlet extends BaseServlet{

    private ProvinceService provinceService = new ProvinceServiceImpl();

    private void findAll(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        List<Province> provinceList = provinceService.findAll();

//        ObjectMapper om = new ObjectMapper();
//        String json = om.writeValueAsString(provinceList);
//
//        resp.getWriter().write(json);
        write2HTML(provinceList,resp);
    }
}
